#include "bsp_exti.h"

void MX_EXTI_Init(void)
{
		/* enable GPIO clock */
		rcu_periph_clock_enable(RCU_GPIOA);
		rcu_periph_clock_enable(RCU_GPIOB);
		rcu_periph_clock_enable(RCU_GPIOC);
		rcu_periph_clock_enable(RCU_GPIOD);
    rcu_periph_clock_enable(RCU_GPIOE);
	  rcu_periph_clock_enable(RCU_AF);//复用使能
			

//掉电检测  PE1
			/* configure button pin as input */
			gpio_init(POWER_CHECK_GPIO_Port, GPIO_MODE_IN_FLOATING, GPIO_OSPEED_50MHZ, POWER_CHECK_Pin);
			/* enable and set key EXTI interrupt to the lowest priority */
			nvic_irq_enable(EXTI1_IRQn, 1U, 0U);//优先级最高
		  /* connect key EXTI line to key GPIO pin */
			gpio_exti_source_select(GPIO_PORT_SOURCE_GPIOE,GPIO_PIN_SOURCE_1);
			/* configure key EXTI line */
			exti_init(EXTI_1, EXTI_INTERRUPT, EXTI_TRIG_FALLING);
			exti_interrupt_flag_clear(EXTI_1);
	
//流量计检测  Pe11

			/* configure button pin as input */
			gpio_init(RO_FLOW_GPIO_Port, GPIO_MODE_IN_FLOATING, GPIO_OSPEED_50MHZ, RO_FLOW_Pin);
			/* enable and set key EXTI interrupt to the lowest priority */
			nvic_irq_enable(EXTI10_15_IRQn, 2U, 0U);
		  /* connect key EXTI line to key GPIO pin */
			gpio_exti_source_select(GPIO_PORT_SOURCE_GPIOE,GPIO_PIN_SOURCE_11);
			/* configure key EXTI line */
			exti_init(EXTI_11, EXTI_INTERRUPT, EXTI_TRIG_RISING); //上升沿
			exti_interrupt_flag_clear(EXTI_11);	

}
	
	
	


